﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace mozhi.smarterp.Business.Migrations
{
    public partial class _202503301550 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MozhiPurchaseOrder_Supplier_SupplierId",
                table: "MozhiPurchaseOrder");

            migrationBuilder.DropTable(
                name: "Supplier");

            migrationBuilder.DropIndex(
                name: "IX_MozhiPurchaseOrder_SupplierId",
                table: "MozhiPurchaseOrder");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Supplier",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Activated = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    Code = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Supplier", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_MozhiPurchaseOrder_SupplierId",
                table: "MozhiPurchaseOrder",
                column: "SupplierId");

            migrationBuilder.AddForeignKey(
                name: "FK_MozhiPurchaseOrder_Supplier_SupplierId",
                table: "MozhiPurchaseOrder",
                column: "SupplierId",
                principalTable: "Supplier",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
